<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
	<button>输出响应体数据</button>
	<button>弹出响应体数据</button>
</body>
<script>
	const btns = document.querySelectorAll("button");
	btns[0].onclick = function(){
		const xhr = new XMLHttpRequest();
		xhr.open("get","./a.json");
		xhr.send();
		xhr.onload = function(){
			console.log(xhr.response);
		}
	}
	btns[1].onclick = function(){
		const xhr = new XMLHttpRequest();
		xhr.open("get","./a.json");
		xhr.send();
		xhr.onload = function(){
			alert(xhr.response);
		}
	}
</script>
</html>